home *** CD-ROM | disk | FTP | other *** search
- #include "vector.h"
-
- int application(int) { return 0; } // dummy function - will not be in use
- rect r_draw_size; // == bound of draw object, expanded or not
-
- Vector::Vector(char* fileName, char* bufName, int obj_num, int step)
- : ApplicationKit(step, loc(39, 13))
- {
- set_object_number(obj_num);
- DATA_FILE = 1;
- // constructors for objects
- rect r_base(0, 0, 80, 25);
- w1 = new Window(r_base, fileName, "", 0, BUTTON_BORDER, NO_BORDER,
- MOVE | RESIZE, 0, 0);
- //////////////////////////////
- rect r_vector(0, 2, 40, 25);
- vector = new KH_OOPic(r_vector, "vector.pcy", NO_BORDER);
- //////////////////////////////
- rect ok_rect(0,0,5,2);
- OK_button = new Button(ok_rect, " OK ");
- //////////////////////////////
- rect r_menu(5, 0, 70, 2);
- static char* hotMenuList = "FBSP"; // hot for line menu
- static char* menuList[] = { " File ", " Buffer ",
- " Script ", " Print ", "" };
- menu = new
- BlockLineMenu(r_menu, "", hotMenuList, menuList, rect(0, 24, 79, 25),
- 0, NULL, NULL, BUTTON_BORDER, 16, 16, 16);
- ////////////////////////////////
- // To be used with MOVE / RESIZE facilities
- // rect r_resize_panel(0, 0, 5, 3);
- // static int ic_resize_list[] = { I_MOVE, I_RESIZE, 0 };
- // loc l = pScreenSet->g_mode == VGAHI ? loc(4, 4) : loc(4, 2);
- // resize_panel = new IconMenu(r_resize_panel, "", "",
- // NULL, 1, 1, SMALL_ICON, ic_resize_list, l,
- // rect(0, 0, 25, 80), 0, NULL, NULL, FIXED, 0,
- // BUTTON_BORDER, NO_BORDER);
- ////////////////////////////////
- /* rect r_script_edit(10, 5, 70, 20); // Editor
- script_editor = new
- BlockWrite(r_script_edit, "", "work.txt", "Editor", 6,
- MOVE | RESIZE, SHOW_BORDER, SHOW_BORDER, SHOW_BORDER,
- 0, 0, 0, 16);
- */
- //////////////////////////
- rect r_edit(40, 2, 80, 25); // Editor
- editor = new Write(r_edit, "work.vec", "", "Interpreter", 6,
- SHOW_BORDER, SHOW_BORDER, 0, 0);
- //////////////////////////
- rect r_file = rect(5, 3, 33, 16);
- static char* hotFileList = "COSAB"; // hot for file menu
- static char* fileList[] = { " Clear ", " Open ",
- " Save", " save As pcx", "save aS pcx B&w",
- " << ? >> ", "" };
-
- file_menu = new BlockMenu(r_file, "", " Files ", 6, hotFileList,
- fileList, rect(0, 24, 79, 25), 0, NULL, NULL,
- FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
- ///////////////////////////
- file_sys = new BlockFile("File");
- //////////////////////////
- rect r_script = rect(50, 4, 69, 14);
- static char* items_script[] = { " Go ", " Record ", " Stop ", " Macros ",
- /*" Text ",*/ "" };
- static char* hotScriptList = "GRSMT"; // for script menu
- script_menu = new BlockMenu(r_script, "", " Scripts ", 6,
- hotScriptList, items_script, rect(0, 24, 79, 25), 0, NULL, NULL,
- FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
- ///////////////////////////
- r_draw_size = vector->user_screen();//rect(9, 2, 80, 24); // init value for draw object == r_draw
- /////////////////////////////
- // rect r = vector->user_screen();
- // r.corner.Y -= 1;
- buffer = NULL; //new GrafBuffer(loc(750, 550), bufName, r);
- print = new PrintManager(EPSON9, DD, 1, rect(1, 1, 1, 1), 0,
- PAPER_ON, 6);
- form = new Form();
- ///////////
- setup = new BufferSetup();
- ///////////
- // We add objects to the container "kit".
- background(w1);
- add(menu);
- add(OK_button);
- add(vector);
- add(editor);
-
- // add(resize_panel); // MOVE and RESIZE the program kit
-
- add(file_menu); // go here from "menu" FILE
- add(setup); // go here from "menu" Buffer
- add(script_menu);
- add(form);
-
- add(file_sys); // go here from "file_menu", "script_menu"...
- add(file_sys);
- add(file_sys);
- add(file_sys);
- // add(script_editor);
-
- // We set the numbers (or the names, which may be transformed to number
- // of the objects which will be called after exiting from current object
- // with ENTER-like command.
- // set_point(fill_prompt, fill_panel);
- // we set, that after exiting from object with ENTER-like command it will
- // call function N + no of menu choice - 1 from appl1.cpp file,
- // and then call object No ... in list. Note that it can overwrite the
- // set_point settings.
- // assign(w1, resize_panel, AC_MOVE); // Reserved
-
- assign(file_menu, menu, AC_FILE_MENU);
- assign(file_sys, file_menu, AC_NEW); // ATTENTION!!! OPEN and SAVE
- // points to the same file_sys object.
- assign(0, OK_button, AC_PROGRAM_SAVE_AND_RUN);
- assign(file_sys, script_menu, AC_SCRIPT_PLAY);
- assign(0, form, AC_PRINT);
- assign(0, file_sys, AC_FILE);
- // assign(0, script_editor, AC_EDITOR);
- assign(0, editor, AC_PROGRAM_RUN);
- assign(editor, vector, AC_PROGRAM_EDIT);
-
- assign(0, setup, AC_BUFFER);
-
- set_exit(AC_ASK_EXIT);
-
- // We can set the numbers (or the names, which may be transformed to number
- // of the objects which will be called after exiting from current object
- // with ESC-like command. If current object was called from another
- // object, its callFrom flag will be changed, correspondingly, so it is not
- // absolutely necessary : kit->set_call(file_menu, menu)...
- // default object hides itself after exiting. But to obtain first-second-third...
- // level menu cascade we must change return flag to 2. In this case menu
- // will hide itself after exiting with ESC-like command, and will not -
- // if the next menu must be called (ENTER command).
- menu->set_ret(RET_CANCEL | RET_STACKED);
- file_menu->set_ret(RET_MOUSE | RET_CANCEL | RET_TRANSFER);
- form->set_ret(RET_MOUSE | RET_CANCEL | RET_OK);
- setup->set_ret(RET_MOUSE | RET_CANCEL | RET_OK);
- script_menu->set_ret(RET_CANCEL | RET_MOUSE | RET_TRANSFER);
- file_sys->set_ret(RET_CANCEL | RET_MOUSE | RET_TRANSFER);
- // script_editor->set_ret(RET_OK | RET_MOUSE | RET_CANCEL);
-
- w1->set_ret(RET_STACKED);
- // resize_panel->set_ret(RET_STACKED);
- editor->set_ret(RET_STACKED);
- // vector->set_ret(RET_STACKED);
-
- // Setting of the context help. ATTENTION!!! only ObjectKit childs have help.
- menu->set_help_context("common ");
- file_menu->set_help_context("file_sys");
- script_menu->set_help_context("script ");
- form->set_help_context("printset");
- setup->set_help_context("bufsetup");
- }
- ///////////////////////////////
- Vector::~Vector()
- {
- editor->hide();
- delete print;
- delete buffer;
- }
- /////////////////////////
- void Vector::show()
- {
- mouseHideCursor();
- WindowManager::show_window(w1);
- WindowManager::show_window(OK_button);
- vector->set_program(vector->load_program("work.vec"));
- WindowManager::show_window(vector);
- WindowManager::show_window(editor);
- WindowManager::show_window(menu);
- // WindowManager::show_window(resize_panel);
-
- moveTo(1);
- mouseShowCursor();
- }
- //////////////////////////
-